"""添加第二类项目算分方法"""


def two_solid_ball(student_test2__grade, student_cell, xlsx_name, sheet_now, student_gender):
    """实心球"""
    try:
        if student_gender == "男":
            if type(student_test2__grade) == int or type(student_test2__grade) == float:
                # print(f'这个{xlsx_name,student_cell}成绩整数或者小数：', student_test2__grade)
                if student_test2__grade >= 12.6:
                    return 120
                elif student_test2__grade >= 9.4:
                    return 120 - ((12.6 - student_test2__grade)/0.8)*5
                elif student_test2__grade >= 5.4:
                    return 110 - ((9.4 - student_test2__grade)/0.2)*5
                else:
                    return 0
        else:
            if type(student_test2__grade) == int or type(student_test2__grade) == float:
                # print(f'这个{xlsx_name,student_cell}成绩整数或者小数：', student_test2__grade)
                if student_test2__grade >= 9.6:
                    return 120
                elif student_test2__grade >= 6.4:
                    return 120 - ((9.6 - student_test2__grade)/0.8)*5
                elif student_test2__grade >= 3.4:
                    return 100 - ((6.4 - student_test2__grade)/0.15)*5
                else:
                    return 0
        if student_test2__grade is None:
            print(f"【{xlsx_name}】工作簿,【{sheet_now}】工作表,第【{student_cell}】行,【实心球】,成绩为空！！！")
        else:
            print(f"【{xlsx_name}】工作簿,【{sheet_now}】工作表,第【{student_cell}】行,【实心球】,【{student_test2__grade}】,数据错误！！！！！！")
    except Exception as e:
        # print(e)
        print(f"【{xlsx_name}】,【{sheet_now}】，第【{student_cell}】,【{student_test2__grade}】错误")


def two_rope_skipping(student_test2__grade, student_cell, xlsx_name, sheet_now, student_gender):
    """跳绳"""
    try:
        if type(student_test2__grade) == int or type(student_test2__grade) == float:
            # print('这个成绩是整形：', student_test2__grade)
            student_test2__grade = int(student_test2__grade)
            if student_test2__grade <= 4:
                return 0
            elif student_test2__grade <= 164:
                return (5/8)*(student_test2__grade-12)+5
            elif student_test2__grade <= 224:
                return (1/3)*(student_test2__grade-164)+100
            elif student_test2__grade > 224:
                return 120
            else:
                return 0
        else:
            # print(f'成绩:{student_test2__grade}为{type(student_test2__grade)}类型，类型错误')
            if student_test2__grade is None:
                print(f"【{xlsx_name}】工作簿,【{sheet_now}】工作表,第【{student_cell}】行,【跳绳】,成绩为空！！！")
            else:
                print(f"【{xlsx_name}】工作簿,【{sheet_now}】工作表,第【{student_cell}】行,【{student_test2__grade}】,数据错误！！！！！！")
    except Exception as e:
        print(f'计算跳绳成绩出错{e}')
        pass


def two_100_run(student_test2__grade, student_cell, xlsx_name, sheet_now):
    """100米跑"""
    pass


def two_50_swim(student_test2__grade, student_cell, xlsx_name, sheet_now, student_gender):
    """50米游泳"""
    try:
        if type(student_test2__grade) == int or type(student_test2__grade) == float:
            # print('这个成绩是整形：', student_test2__grade)
            student_test2__grade = float(student_test2__grade)
            if student_gender == "男":
                if student_test2__grade >= 240:
                    return 0
                elif student_test2__grade >= 100:
                    return format((240-student_test2__grade)*0.5+0, '.2f')
                elif student_test2__grade >= 85:
                    return format((100 - student_test2__grade) * 1 + 70, '.2f')
                elif student_test2__grade >= 70:
                    return format((85-student_test2__grade)*(1/3)+85, '.2f')
                elif student_test2__grade >= 60:
                    return format((65-student_test2__grade)*1+95, '.2f')
                elif student_test2__grade >= 48:
                    return format((57-student_test2__grade)*(5/3)+105, '.2f')
                elif student_test2__grade > 0:
                    return 120
                else:
                    # 小于零成绩错误
                    pass
            elif student_gender == "女":
                if student_test2__grade >= 250:
                    return 0
                elif student_test2__grade >= 110:
                    return format((250 - student_test2__grade) * 0.5 + 0, '.2f')
                elif student_test2__grade >= 95:
                    return format((105 - student_test2__grade) * 1 + 75, '.2f')
                elif student_test2__grade >= 80:
                    return format((95 - student_test2__grade) * (1 / 3) + 90, '.2f')
                elif student_test2__grade >= 70:
                    return format((75-student_test2__grade)*1+95, '.2f')
                elif student_test2__grade >= 58:
                    return format((67-student_test2__grade)*(5/3)+105, '.2f')
                elif student_test2__grade > 0:
                    return 120
                else:
                    # 小于零成绩错误
                    pass
            else:
                # 未填写正确性别
                print(f"【{xlsx_name}】工作簿,【{sheet_now}】工作表,第【{student_cell}】行,【{student_gender}】,性别填写错误！！！！！！")
                pass
        else:
            print(f"【{xlsx_name}】工作簿,【{sheet_now}】工作表,第【{student_cell}】行,【{student_test2__grade}】,数值类型错误！！！！！！")
    except Exception as e:
        print('计算50米游泳成绩失败', e)


def two_shuttlecock(student_test2__grade, student_cell, xlsx_name, sheet_now, student_gender):
    """踢毽子"""
    try:
        if student_gender == "男":
            if type(student_test2__grade) == int or type(student_test2__grade) == float:
                # print(f'这个{xlsx_name,student_cell}成绩整数或者小数：', student_test2__grade)
                if student_test2__grade >= 130:
                    return 120
                elif student_test2__grade >= 90:
                    return 120 - ((130 - student_test2__grade)/10)*5
                elif student_test2__grade >= 5:
                    return 100 - (90 - student_test2__grade)
                elif student_test2__grade == 3:
                    return 10
                elif student_test2__grade == 2:
                    return 5
                elif student_test2__grade == 1:
                    return 2.5
                else:
                    return 0
        else:
            if type(student_test2__grade) == int or type(student_test2__grade) == float:
                # print(f'这个{xlsx_name,student_cell}成绩整数或者小数：', student_test2__grade)
                if student_test2__grade >= 140:
                    return 120
                elif student_test2__grade >= 100:
                    return 120 - (140 - student_test2__grade)*0.5
                elif student_test2__grade >= 0:
                    return 100 - (100 - student_test2__grade)
                else:
                    return 0
        if student_test2__grade is None:
            print(f"【{xlsx_name}】工作簿,【{sheet_now}】工作表,第【{student_cell}】行,【踢毽子】,成绩为空！！！")
        else:
            print(f"【{xlsx_name}】工作簿,【{sheet_now}】工作表,第【{student_cell}】行,【踢毽子】,【{student_test2__grade}】,数据错误！！！！！！")
    except Exception as e:
        # print(e)
        print(f"【{xlsx_name}】,【{sheet_now}】，第【{student_cell}】,【{student_test2__grade}】错误")
    pass


def two_frog_jump(student_test2__grade, student_cell, xlsx_name, sheet_now):
    """蛙跳"""
    pass


def two_4_10_again_run(student_test2__grade, student_cell, xlsx_name, sheet_now):
    """4*10折返跑"""
    pass
